//    Copyright (C) Kherty.  All rights reserved.
using OpenLS.Core.Serialization;

namespace OpenLS.Drawing
{
    public abstract class Geometry : IOfficeXmlSerializable
    {
        internal abstract System.Windows.Media.Geometry GetWPFGeometry(ShapeProperties shape, bool arrows);

        #region IOfficeXmlSerializable Members

        void IOfficeXmlSerializable.ReadXml(ReadContext context)
        {
            ReadXmlCore(context);
        }

        void IOfficeXmlSerializable.WriteXml(WriteContext context)
        {
            WriteXmlCore(context);
        }

        #endregion

        internal static Geometry ReadGeometry(ReadContext context)
        {
            switch (context.ReaderLocalName)
            {
                case "custGeom":
                    CustomGeometry2D c = new CustomGeometry2D();
                    c.ReadXmlCore(context);
                    return c;
                case "prstGeom":
                    PresetGeometry2D g = new PresetGeometry2D();
                    g.ReadXmlCore(context);
                    return g;
                default:
                    return null;
            }
        }

        internal abstract void ReadXmlCore(ReadContext context);

        internal abstract void WriteXmlCore(WriteContext context);
        //\\name
    }
}